<template>
  <view>
    <yn-viewer :showBackBtn="true">
      <yn-ar
        disable-scroll
        id="main-frame"
        :width="renderWidth"
        :height="renderHeight"
        :style="`width:${width}px;height:${height}px;`"
        yn_asset="https://cttxhy-1360132035.cos.ap-shanghai.myqcloud.com/characters/Fox.glb"
        yn_camera_clear_color="0.89 0.69 0.94 1"
      />
    </yn-viewer>
  </view>
</template>

<script>
export default {
  data() {
    return {
      width: 300,
      height: 300,
      renderWidth: 300,
      renderHeight: 300,
    };
  },
  onLoad() {
    const info = uni.getSystemInfoSync();
    this.width = info.windowWidth;
    this.height = info.windowHeight;
    this.renderWidth = info.windowWidth * info.pixelRatio;
    this.renderHeight = info.windowHeight * info.pixelRatio;
  },
};
</script>

<!-- 页面json配置，uni-app里是单独json文件，或者直接在微信小程序编译目录手动添加 -->
<!-- pages/index/index.json -->
